The VBA Second function returns an integer corresponding to the seconds of the specified date or time.
Second(date_hour)
Using the Second function to get the appropriate time information:
Sub SecondExample1()
myHour = #6:36:45PM#
MsgBox Second(myHour) 'Returns: 45
End Sub
Or by date and time (for the same result):
Sub SecondExample2()
myDate = #10/31/2020 6:36:45 PM#
MsgBox Second(myDate) 'Returns: 45
End Sub
This function also accepts dates and times in text format:
Sub SecondExample3()
myDate = "10/31/2020 18:36:45"
MsgBox Second(myDate) 'Returns: 45
End Sub